/// <reference path="../Scripts/jquery-1.7.1.min.js" />
/// <reference path="../Scripts/knockout-2.1.0.js" />

function LocalPasswordViewModel() {
	var self = this;
	self.OldPassword = ko.observable();
	self.NewPassword = ko.observable();
	self.ConfirmPassword = ko.observable();

	self.ChangePassword = function () {

		//alert("We are in the ChangePassword ko function");
	    $("#ChangePassForm").validate({

	    });
	    if (!$("#ChangePassForm").valid()) {
	        //alert("Invalied");
	        return;
	    }
		var myData = ko.toJSON(this);
		jQuery.ajax({
			url: "./account/manage/",
			type: 'post',
			data: myData,
			contentType: 'application/json',
			success: function (result) {
			    $('#success-dis').text('Password reset link has been sent to your email');
			    $('#register-error').css({ 'display': 'none' });
			    $('#success-msg').css({ 'display': 'block' });
			    $(document).scrollTop(0);
			    location.href = "/";

			},
			error: function (jqXHR, textStatus, thrownError) {
			    $('#error-dis').text(thrownError);
			    $('#register-error').css({ 'display': 'block' });

			}

		});
	}; //End of add procedure
}; //End of view model







